
<div class="widget-container">
    <?php
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'categories-form',
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data',
            'class' => 'form-horizontal'
        ),
    ));
    ?>
    <?php echo CHtml::errorSummary($model); ?>
    <div class="btn-group btn-group-admin">
        <?php
        if ($model->getScenario() == 'update') {
            echo Chtml::link('Thêm mới', array('create'), array('class' => 'btn btn-primary'));
            echo Chtml::link('Xóa', array('delete', 'id' => $model->id), array('class' => 'btn btn-primary'));
        } else {
            echo Chtml::link('Danh sách', array('index'), array('class' => 'btn btn-primary'));
        }
        ?>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-refresh"></i>
                    </span>
                    <h5>Thêm mới</h5>
                </div>
                <div class="widget-content nopadding">
                    <div class="control-group">
                        <?php echo $form->labelEx($model, 'name', array('class' => 'control-label')); ?>
                        <div class="controls">
                            <?php
                            echo $form->textField($model, 'name', array('class' => 'span8'));
                            ?>
                            <?php echo $form->error($model, 'name'); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <?php echo $form->labelEx($model, 'alias', array('class' => 'control-label')); ?>
                        <div class="controls">
                            <?php
                            echo $form->textField($model, 'alias', array('class' => 'span8'));
                            ?>
                            <?php echo $form->error($model, 'alias'); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <?php echo $form->labelEx($model, 'status', array('class' => 'control-label')); ?>
                        <div class="controls">
                            <?php echo $form->checkBox($model, 'status', array('value' => '1', 'checked' => 'checked')); ?>
                            <?php echo $form->error($model, 'status'); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <?php echo $form->labelEx($model, 'rank', array('class' => 'control-label')); ?>
                        <div class="controls">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="rank[]"  value="<?php echo NewsCategories::MENU ?>">
                                    Menu
                                </label>
                                <label>
                                    <input type="checkbox" name="rank[]"  value="<?php echo NewsCategories::LEFT ?>"> Left

                                </label>
                                <label>
                                    <input type="checkbox" name="rank[]"  value="<?php echo NewsCategories::RIGHT ?>"> Right

                                </label>
                                <label>
                                    <input type="checkbox" name="rank[]" value="<?php echo NewsCategories::CENTER ?>">Center

                                </label>
                            </div>

                        </div>
                    </div>

                </div>
            </div>


        </div>
        <div class="span12">
            <div class="form-actions">
                <?php echo CHtml::submitButton('Luu', array('class' => 'btn btn-success')); ?>

            </div>
        </div>

        <?php
        $this->endWidget();
        ?>

    </div><!-- form -->

    <script>
        $(function() {
            $('#NewsCategories_name').keyup(function() {
                title = $('#NewsCategories_name').val();
                $('#NewsCategories_alias').val(convertToSlug(title));
            });
        });
    </script>